layui.define("jquery", function (e) {
	var $ = layui.$,
		f = {
		getSize: function (element) {
			var obj = {
				innerWidth: 0,
				innerHeight: 0
			};
			var elementParent = element.parent();
			var parenth = elementParent.innerHeight();
			if (elementParent.css("padding-top")) {
				parenth -= parseInt(elementParent.css("padding-top"))
			}
			if (elementParent.css("padding-bottom")) {
				parenth -= parseInt(elementParent.css("padding-bottom"))
			}
			var parentw = elementParent.innerWidth();
			if (elementParent.css("padding-left")) {
				parentw -= parseInt(elementParent.css("padding-left"))
			}
			if (elementParent.css("padding-right")) {
				parentw -= parseInt(elementParent.css("padding-right"))
			}
			obj.innerWidth = parentw;
			obj.innerHeight = parenth;
			return obj
		},
		hmax: function (element) {
			var obj = this.getSize(element);
			var parenth = obj.innerHeight;
			var parentw = obj.innerWidth;
			var hmaxn = element.siblings(".layui-h-max").length + 1;
			var sibls = $(element).siblings(":not(.layui-h-max)").not("script");
			var sibl = sibls.not(".f-absolute");
			var siblingn = sibl.length;
			var sum = 0;
			for (var i = 0; i < siblingn; i++) {
				if($(sibl[i]).css("position") != "absolute"){
					sum += $(sibl[i]).outerHeight(true);
				}
			}
			var yu = (parenth - sum) % hmaxn;
			var hmaxH = Math.floor((parenth - sum) / hmaxn);
			if (element.index() < yu) {
				hmaxH = hmaxH + 1;
			}
			element.outerHeight(hmaxH, true).outerWidth(parentw, true)
		},
		hauto: function (element) {
			var obj = this.getSize(element);
			var parenth = obj.innerHeight;
			var hmaxn = element.siblings(".layui-h-auto").length + 1;
			var sibls = element.siblings(":not(.layui-h-auto)").not("script");
			var sibl = sibls.not(".f-absolute");
			var siblingn = sibl.length;
			var sum = 0;
			for (var i = 0; i < siblingn; i++) {
				if($(sibl[i]).css("position") != "absolute"){
					sum += $(sibl[i]).outerHeight(true);
				}
			}
			var yu = (parenth - sum) % hmaxn;
			var hmaxH = Math.floor((parenth - sum) / hmaxn);
			if (element.index() < yu) {
				hmaxH = hmaxH + 1;
			}
			element.outerHeight(hmaxH, true);
		},
		auto: function () {
			$("body").find(".layui-h-max").each(function (i, ele) {
				f.hmax($(ele));
			});
			$("body").find(".layui-h-auto").each(function (i, ele) {
				f.hauto($(ele));
			})
		}
	};
	f.auto();
	$(window).resize(function(){
		f.auto();
	});
	e("full", f)
});